import { IPSDEUICtrlFireEventLogic } from './ipsdeuictrl-fire-event-logic';
import { IPSDEUILogic } from './ipsdeuilogic';
import { IPSDEUILogicParam } from './ipsdeuilogic-param';
import { PSDEUILogicNodeImpl } from './psdeuilogic-node-impl';

export class PSDEUICtrlFireEventLogicImpl extends PSDEUILogicNodeImpl implements IPSDEUICtrlFireEventLogic {
  get eventName(): string {
    return this.M.eventName;
  }

  protected eventparam: IPSDEUILogicParam | null = null;

  getEventParam(): IPSDEUILogicParam | null {
    if (this.eventparam != null) return this.eventparam;
    const value = this.M.getEventParam;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.eventparam = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.eventparam;
  }

  get eventParam(): IPSDEUILogicParam | null {
    return this.getEventParam();
  }

  getEventParamMust(): IPSDEUILogicParam {
    const value = this.getEventParam();
    if (value == null) {
      throw new Error('未指定事件参数');
    }
    return value;
  }

  protected firectrl: IPSDEUILogicParam | null = null;

  getFireCtrl(): IPSDEUILogicParam | null {
    if (this.firectrl != null) return this.firectrl;
    const value = this.M.getFireCtrl;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.firectrl = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.firectrl;
  }

  get fireCtrl(): IPSDEUILogicParam | null {
    return this.getFireCtrl();
  }

  getFireCtrlMust(): IPSDEUILogicParam {
    const value = this.getFireCtrl();
    if (value == null) {
      throw new Error('未指定触发对象');
    }
    return value;
  }

  protected srcpsdeuilogicparam: IPSDEUILogicParam | null = null;

  getSrcPSDEUILogicParam(): IPSDEUILogicParam | null {
    if (this.srcpsdeuilogicparam != null) return this.srcpsdeuilogicparam;
    const value = this.M.getSrcPSDEUILogicParam;
    if (value == null) {
      return null;
    }
    const ipsdeuilogic = this.getParentPSModelObject('dataentity.logic.IPSDEUILogic') as IPSDEUILogic;
    if (ipsdeuilogic != null) {
      this.srcpsdeuilogicparam = ipsdeuilogic.findPSDEUILogicParam(value);
    }
    return this.srcpsdeuilogicparam;
  }

  get srcPSDEUILogicParam(): IPSDEUILogicParam | null {
    return this.getSrcPSDEUILogicParam();
  }

  getSrcPSDEUILogicParamMust(): IPSDEUILogicParam {
    const value = this.getSrcPSDEUILogicParam();
    if (value == null) {
      throw new Error('未指定源逻辑参数对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEUICtrlFireEventLogicImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDEUICtrlFireEventLogic') return true;
    return super.instanceof(cls);
  }
}
